package  
{
	import org.flixel.FlxEmitter;
	import org.flixel.FlxSprite;
	import org.flixel.FlxG;
	
	/**
	 * ...
	 * @author Enric Llagostera
	 */
	public class Block extends FlxSprite 
	{
		
		[Embed(source = "../assets/BlockWall.png")] private var imgWall:Class;
		[Embed(source = "../assets/BlockMult.png")] private var imgMult:Class;
		[Embed(source = "../assets/BlockHazard.png")] private var imgMine:Class;
		
		public var type:String;
		public var owner:BlockyPlayer;
		
		public var emitter:FlxEmitter;
		
		public function Block(X:Number, Y:Number, pType:String, pOwner:BlockyPlayer) 
		{
			super(X, Y);
			
			type = pType;
			owner = pOwner;
			
			mass = 10;
			drag.x = drag.y = 1000;
			maxVelocity.x = maxVelocity.y = 200;
			
			// temp graphics
			if (type == "wall") {
				loadGraphic(imgWall);
				width = height = 28;
				offset.x = offset.y = 2;
				health = 100;
			}
			else if (type == "mult") {
				loadGraphic(imgMult);
				width = height = 28;
				offset.x = offset.y = 2;
				health = 10;
			}
			else if (type == "mine") {
				loadGraphic(imgMine);
				width = 28;
				height = 16;
				offset.x = 2;
				offset.y = 14;
				health = 40;
			}
			
			if (owner.ID == 1) {
				color = 0xffff00;
			}
			else {
				color = 0x6b3d99;
			}
			
			emitter = null;
			
			immovable = true;
			
		}
		
	}

}